package com.bsg.upm.task;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.bsg.upm.entity.SiteEntity;
import com.bsg.upm.service.BaseService;
import com.bsg.upm.service.MonitorAlarmService;
import com.bsg.upm.service.MonitorEventService;

@Service
public class MonitorEventTask extends BaseService {
	@Resource
	private MonitorEventService monitorEventService;
	@Resource
	private MonitorAlarmService monitorAlarmService;

	public void doEventHandleTask() {
		try {
			logger.info("获取事件数据，并整合插入事件表中");

			List<SiteEntity> sites = siteDao.list(null);
			if (sites == null) {
				return;
			}

			for (SiteEntity siteEntity : sites) {
				monitorEventService.handleTask(siteEntity.getId());
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void doAlamHandleTask() {
		logger.info("向第三方告警平台 发送  告警信息");
		monitorAlarmService.sendHandleTask();
	}
}
